package top.ninwoo.bishe.starter.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@Slf4j
@Configuration
@ComponentScan(value = "top.ninwoo.bishe.starter")
@EnableConfigurationProperties(ClientProperties.class)
public class BisheAppAutoConfiguration {

    @Resource
    private ClientProperties clientProperties;

    @PostConstruct
    public void init() {
        log.info("开启这个client-starter");
        log.info("cloud配置为{}", clientProperties);
    }

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
